package com.puscene.framwork.test;

import com.puscene.framwork.R;
import com.puscene.framwork.base.FragmentIntent;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends BaseActivity {
	
	Button firstPage;
	Button seconPage;
	Button thirdPage;
	
	
	@Override
	protected void onCreate(@Nullable Bundle arg0) {
		// TODO Auto-generated method stub
		super.onCreate(arg0);
		setContentView(R.layout.main_activity);
		
		final FragmentIntent fragmentIntent = new FragmentIntent(R.id.contentLayout, null, getSupportFragmentManager());
		fragmentIntent.setAddToBackStack(false);
		fragmentIntent.setSingleInstance(true);
		
		firstPage = (Button) findViewById(R.id.firstPage);
		firstPage.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				fragmentIntent.setFragmentClass(FirstFragment.class);
				showFragment(fragmentIntent);
			}
		});
		seconPage = (Button) findViewById(R.id.seconPage);
		seconPage.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				fragmentIntent.setFragmentClass(SeconFragment.class);
				showFragment(fragmentIntent);
			}
		});
		thirdPage = (Button) findViewById(R.id.thirdPage);
		thirdPage.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				fragmentIntent.setFragmentClass(ThirdFragment.class);
				showFragment(fragmentIntent);
			}
		});
	}
}
